package com.fs.controller;


import com.fs.entity.Materialcategory;
import com.fs.entity.Materials;
import com.fs.entity.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.fs.service.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2024-06-12
 */
@RestController
@RequestMapping("/students")
public class StudentsController {
    @Autowired
    IMaterialcategoryService iMaterialcategoryService;
    @Autowired
    IMaterialsService MaterialsServiceImpl;
    //获取材料类别名称
    @GetMapping("/GetKind")
    public ResponseData getKind(int mckind){
        List<Materialcategory> categories = iMaterialcategoryService.getKind(mckind);
        return ResponseData.ok(categories);
    }
    @PostMapping("/handleMaterial")
    public ResponseData handleMaterial(Materials material){
        boolean result = MaterialsServiceImpl.handle(material);
        if (result){
            return ResponseData.ok();
        }
        return ResponseData.error("处理失败");
    }


}
